<?php

class BusinessTypes extends HTech_Db_Table
{
    protected $_name    = 'view_business_types';
    protected $_primary = 'TypeId';

    protected function _setGridMetadata()
    {
        $this->_gridMetadata['title'] = $this->translate("Business types");
        $this->_gridMetadata['onClick'] = 'admin.business-type.add';
        $this->_gridMetadata['headers'] = array
            (
                array('Activity',         100, $this->translate("Activity"),       'String'),
                array('Type',             200, $this->translate("Type"),           'String'),
                array('Description',      200, $this->translate("Description"),    'String'),
                array('LastEditDate',     120, $this->translate("Last edit date"), 'DateTime', 'Date'),
                array('LastEditFullName', 150, $this->translate("Last edit user"), 'String')
            );
        return $this;
    }   
    
    static function getTypeOptions($activity = '')
    {
        if($activity) 
            return Zend_Registry::get('db')->fetchPairs('select TypeId, Type from business_types where Activity = ?', $activity);
        return array();
    }
}